
//
// 101123 - AH - Created.
// 110808 - AH - (Bybanen *) Deprecated. TODO: Delete.
//

package org.soekrat.gui.swing.resource;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dialog;
import java.awt.Frame;

import javax.swing.JDialog;

import org.soekrat.engine.Soekrat2Engine;

/**
 * <p>
 *   Dialog showing the
 *   {@link ResourceWall}.
 * </p>
 * @author Arne Halvorsen (AH)
 * @author Laetitia Le Chatton (LLC) 
 */
@Deprecated
@SuppressWarnings("serial")
public final class ResourceWallDialog extends JDialog 
{
  private ResourceWall m_wall;
  
  /**
   * <p>
   *   Constructor.
   * </p>
   * @param e {@link Soekrat2Engine} being used.
   */
  public ResourceWallDialog(Soekrat2Engine e){ buildGui(e); }
  
  /**
   * <p>
   *   Constructor.
   * </p>
   * @param p Dialog's parent.
   * @param e {@link Soekrat2Engine} being used.
   */
  public ResourceWallDialog(Frame p, Soekrat2Engine e){ super(p); buildGui(e); }
  
  /**
   * <p>
   *   Constructor.
   * </p>
   * @param p Dialog's parent.
   * @param e {@link Soekrat2Engine} being used.
   */
  public ResourceWallDialog(Dialog p, Soekrat2Engine e){ super(p); buildGui(e); }
  
  // Invoked from constructors.
  private void buildGui(Soekrat2Engine engine)
  {
    if (engine==null)
    {
      throw new NullPointerException("engine");
    }
    
    setTitle("Resource Wall");
    
    Container c=getContentPane();
    c.setLayout(new BorderLayout());
    
    m_wall=new ResourceWall(engine);
    c.add(m_wall, BorderLayout.CENTER);
    
    pack();
    setSize(400, 400);
  }
  
  /**
   * <p>
   *   Shows dialog.
   * </p>
   */
  public void showDialog()
  {
    setVisible(true);
    m_wall.updateWall();
  }
  
}
